﻿<div ng-controller="merchantController">
	<div class="wrapper border-bottom white-bg page-heading">
		<div class="col-lg-pull-12">
			<ol class="breadcrumb">
				<li><a href="javascript:void(0)" ng-click="goBack()">商户</a></li>
				<li class="active" ng-bind="breadcrumb"></li>
			</ol>
		</div>
	</div>
	<form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" role="form" novalidate>
		<div class="form-group">
			<label class="col-sm-2 control-label">名称:</label>
			<div class="col-sm-3">
				<input type="text" name="name" class="form-control input-sm" ng-model="model.name" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">编号:</label>
			<div class="col-sm-3">
				<input type="text" name="grade_no" class="form-control input-sm" ng-model="model.grade_no" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">排序:</label>
			<div class="col-sm-3">
				<input type="number" name="sort" class="form-control input-sm" ng-model="model.sort" required>
			</div>
		</div>
		<div class="form-group form-group-sm">
			<div class="col-sm-2">
				<button type="button" class="btn btn-primary btn-sm" ng-click="open_payment()">
					<i class="fa fa-plus"></i> 增加支付方式
				</button>
			</div>
		</div>
		<table class="table table-hover">
			<thead>
				<tr>
					<th width="50">通道</th>
					<th width="100">名称</th>
					<th width="100">编号</th>
					<th width="80">排序</th>
					<th width="80">是否启用</th>
					<th width="80">别名</th>
					<th width="80">支付费率</th>
					<th width="80">结算类型</th>
					<th width="80">结算费</th>
					<th width="80">单笔额度</th>
					<th width="80">单卡额度</th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="item in model.payments">
					<td>{{channel_name(item.payment.channel)}}</td>
					<td>{{item.payment.name}}</td>
					<td>{{item.payment.code}}</td>
					<td><input type="number" name="item.sort" class="form-control input-sm" ng-model="item.sort" required></td>
					<td colspan="7">
						<table class="table">
							<tr ng-repeat="settle in item.settles">
								<td><input type="checkbox" ng-model="settle.is_open" ng-true-value="true" ng-false-value="false"></td>
								<td><input name="settle.name" type="name" class="form-control input-sm" ng-model="settle.name" w5c-dynamic-element required></td>
								<td><input name="settle.fee" type="number" class="form-control input-sm" ng-model="settle.fee" w5c-dynamic-element required></td>
								<td>{{settle.settle_type}}</td>
								<td><input name="settle.settle" type="number" class="form-control input-sm" ng-model="settle.settle" w5c-dynamic-element required></td>
								<td><input name="settle.single_quota" type="text" class="form-control input-sm" ng-model="settle.single_quota"></td>
								<td><input name="settle.card_quota" type="text" class="form-control input-sm" ng-model="settle.card_quota"></td>
							</tr>
						</table>
					</td>
				</tr>
			</tbody>
		</table>
		<div class="form-group">
			<label class="col-sm-2 control-label"></label>
			<div class="col-sm-3">
				<button type="submit" w5c-form-submit="save_grade()" class="btn btn-primary btn-sm" btn-loading="psdisabled.save" loading-text="保存中..." ng-disabled="psdisabled.save">
					<i class="fa fa-save"></i> 保存
				</button>
				<button ng-click="goBack()" class="btn btn-primary btn-sm"><i class="fa fa-rotate-left"></i> 取消</button>
			</div>
		</div>
	</form>
</div>